package routers

import (
	"wx-uniapp-go/api/controller/cart"
	"wx-uniapp-go/internal/middleware"
)

// InitCartRoute 初始化购物车路由
func InitCartRoute() {
	// 购物车相关路由组
	cartGroup := engine.Group("/cart").Use(middleware.CheckLogin())
	{
		cartGroup.GET("", cart.GetCartList)                   // 获取购物车列表
		cartGroup.GET("/count", cart.GetCartCount)            // 获取购物车商品总数
		cartGroup.GET("/stock", cart.GetCartStock)            // 获取购物车商品库存状态
		cartGroup.POST("/add", cart.AddCart)                  // 添加购物车
		cartGroup.POST("/update", cart.UpdateCart)            // 更新购物车
		cartGroup.POST("/delete", cart.DeleteCart)            // 删除购物车
		cartGroup.POST("/clear", cart.ClearCart)              // 清空购物车
		cartGroup.POST("/selected", cart.BatchUpdateSelected) // 批量更新选中状态
		cartGroup.POST("/order", cart.CreateOrder)            // 创建订单
	}
}
